package com.bw.liveplay.common.mvvm.adapter

import android.widget.ImageView
import android.widget.TextView
import com.bw.liveplay.R
import com.bw.liveplay.common.entity.FeedEntity
import com.bw.liveplay.common.network.LoadImage
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer

/**
 * @author KK
 * @description:
 * @date :2021/11/12 8:43
 *
 */
class VideoAdapter : BaseQuickAdapter<FeedEntity, BaseViewHolder>(R.layout.item_video) {
    override fun convert(holder: BaseViewHolder, item: FeedEntity) {
        var head = holder.getView<ImageView>(R.id.item_video_head)
        var text = holder.getView<TextView>(R.id.item_video_text)
        var name = holder.getView<TextView>(R.id.item_video_name)
        val gsy : StandardGSYVideoPlayer = holder.getView(R.id.item_video_gsy)

        var avatar = item.author!!.avatar
        if (avatar != null) {
            LoadImage.loadcrile(avatar,head)
        }//设置头像

        text.setText(item.author!!.name)//名称
        name.setText(item.feeds_text)//作者编辑的话

        gsy.setUp(item.url, false, "视频")



    }
}